package com.ljx.blog.user.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ljx.blog.security.util.UserUtil;
import com.ljx.blog.user.domain.entity.Permission;
import com.ljx.blog.user.mapper.PermissionMapper;
import com.ljx.blog.user.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-10-03  21:35
 */
@Service
public class PermissionServiceImpl extends ServiceImpl<PermissionMapper, Permission> implements PermissionService {

    @Autowired
    private PermissionMapper permissionMapper;

    @Override
    public List<Long> getPermissionIdByRoleIds(List<Long> roleIds) {
        return permissionMapper.getPermissionByUserId(roleIds);
    }

    @Override
    public List<Permission> getPermissionByIds(List<Long> ids) {
        if (ids.isEmpty()) {
            return new ArrayList<>();
        }
        return listByIds(ids);
    }
}
